{layout name="layout/header" /}
<link href="root/css/plugins/iCheck/custom.css" rel="stylesheet">
<link href="root/css/plugins/summernote/summernote.css" rel="stylesheet">
<link href="root/css/plugins/summernote/summernote-bs3.css" rel="stylesheet">
<link href="root/js/plugins/fancybox/jquery.fancybox.css" rel="stylesheet">

<div class="wrapper wrapper-content animated fadeInRight">

    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>系统设置</h5>
                </div>
                <div class="ibox-content">
                    <p>
                        <button type="button" class="btn btn-primary btn-outline refresh">刷新</button>
                    </p>
                </div>
                <div class="ibox-content">
                    <form method="post" class="form-horizontal" id="form" action="{:url('index')}">
                        <!--基本资料-->
                        <div class="form-group">
                            <label class="col-sm-2 control-label">项目名称</label>
                            <div class="col-sm-10">
                                <input type="text" name="app_name" class="form-control" value="{$data.app_name}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">app下载地址</label>
                            <div class="col-sm-10">
                                <input type="text" name="app_download_url" class="form-control" value="{$data.app_download_url}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">app登陆接口地址</label>
                            <div class="col-sm-10">
                                <input type="text" name="app_login_api" class="form-control" value="{$data.app_login_api}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">app_ua</label>
                            <div class="col-sm-10">
                                <input type="text" name="app_ua" class="form-control" value="{$data.app_ua}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">APP Logo</label>
                            <div class="col-sm-10">
                                <button class="btn btn-success product_upload_img" type="button">
                                    <i class="fa fa-upload"></i>&nbsp;&nbsp;<span class="bold">上传</span>
                                </button>
                                <input class="img" type="file" style="display: none;" data-field="logo" name="img"/>
                                <!--<span class="help-block m-b-none">比例：100像素*100像素</span>-->

                            </div>
                            <div class="col-sm-10 col-sm-offset-2 ">
                                <div class="row" id="logo">
                                    {notempty name="$data.logo"}
                                    <div class="img_box col-xs-12 col-md-3" >
                                        <a class="fancybox" href="{$data.logo}">
                                            <img alt="image" src="{$data.logo}" name="logo"/>
                                        </a>
                                        <a class="glyphicon glyphicon-trash" onclick="del_img(this,'img');"></a>
                                        <input type="hidden" name="logo" value="{$data.logo}">
                                    </div>
                                    {/notempty}
                                </div>
                            </div>
                        </div>

                        <!--<div class="form-group">-->
                            <!--<label class="col-sm-2 control-label">小程序使用说明</label>-->
                            <!--<div class="col-sm-10">-->
                                <!--<textarea name="use_text"  style="display: none;"></textarea>-->
                                <!--<div class="ibox-content no-padding" >-->
                                    <!--<div class="summernote" >-->
                                     <!---->
                                    <!--</div>-->
                                <!--</div>-->
                            <!--</div>-->
                        <!--</div>-->

                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" onclick="save(event)">保存</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

</div>

<!-- iCheck -->
<script src="root/js/plugins/iCheck/icheck.min.js"></script>
<!--layer-->
<script src="root/js/plugins/layer/layer.min.js"></script>

<script src="root/js/plugins/validate/jquery.validate.min.js"></script>
<script src="root/js/plugins/validate/messages_zh.min.js"></script>
<script src="root/js/plugins/fancybox/jquery.fancybox.js"></script>
<script src="root/js/plugins/summernote/summernote.min.js"></script>
<script src="root/js/plugins/summernote/summernote-zh-CN.js"></script>
<script>
    $(document).ready(function () {
        checks();
        $('.fancybox').fancybox({
            openEffect: 'none',
            closeEffect: 'none'
        });

    });

</script>
<script>
    function save(event) {
        event.preventDefault();
        if (confirm("是否确定修改系统设置？")) {
            $("#form").submit();
        }
    }
    $(function () {
        $("#form").validate({
            rules: {
                app_name: {
                    required:true,
                },
                app_download_url: {
                    required:true,
                },
                app_ua: {
                    required:true,
                },

            }
        })
    })
</script>
<script type="text/javascript">
    //summernote编辑器图片上传

    $('.summernote').summernote({
        lang:'zh-CN',
        disableDragAndDrop: true,
        // 重写图片上传
        onImageUpload: function(files, editor, $editable) {
            sendFile(files[0],editor,$editable);
        },
        onblur:function () {
            var content = $(this).code();
            $(this).parent().parent().prev().val(content);
        }
    });



</script>